Skip to content

Conversation

@mzbroch
Copy link
Contributor

@mzbroch mzbroch commented Feb 20, 2024

  • class refactor - distinguish between "actions" and ACL attributes , move "actions"/"settings" under ACL.Meta class
  • unittests
  • Cartesian product supports None values: src_ip': None, 'dst_ip': None, 'action': None}
  • drop order_* methods
  • option to raise exceptions in validate_
  • aggregate results in validate_ and enforce_
  • remove dst_port processor,
  • -- provide additional examples through docs or contrib
  • docs updates

itdependsnetworks and others added 30 commits June 3, 2021 06:09
* Add ASA parser

Co-authored-by: Justin Drew <jdrew82@users.noreply.github.com>
* Add BASE_INTERFACES for hp_comware & checkpoint

Co-authored-by: Josef Fuchs <josef.fuchs@pankl.com>
…ion_docs

Updated attribution and contribution doc start-lines
move sphinx to dev dep, update docs, update metadata
* Small performance enhancers

- remove redundant call to `str`
- `get_all_host` list to generator to avoid memory overhead of very
large lists

* Add lookup table for netmasks

There are only 32 + 128 valid IPv4/6 netmasks, so I created a lookup
table for easy validation.  If there are concerns about the memory
overhead, a computed version is easy enough to implement.

* Make netutils dual-stack

I modified functions where I could to make them compatible with IPv6.
Per [RFC4291](https://datatracker.ietf.org/doc/html/rfc4291#section-4),
I have assumed any addresses in the ::/8 range are IPv4.
The one exception is `cidr_to_netmask`.  I added a v6 version of that
function.

* Modify/add tests for proposed functionality
* remove count_bits tests

* Remove count_bits in favor of simpler/faster function
* interface_range_expansion function added
Co-authored-by: Adam Byczkowski <38091261+qduk@users.noreply.github.com>
Co-authored-by: Adam Byczkowski <38091261+qduk@users.noreply.github.com>
* Added ability to create interface lists
* Added document page for lib_mappings
* Updated lib mapping description and added README for pypi
* Update Scrapli variable name to include lib_mapper
netutils/acl.py Outdated
return str(item.deny) # pylint: disable=undefined-loop-variable
if item.match(rule): # mzb: bugfix
return True # mzb: change to bool
return False # pylint: disable=undefined-loop-variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this as string as most vendors have more than just permit or deny, this is Palo's

allow
deny
drop
reset client
reset server
reset client and server

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO match method should return only True/False if the rule is/not matched by the check. This should only check if A contains B.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is reasonable to have different levels.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, I see this in a little different way :

def match_action(action, match_action):
    deny_actions = ['deny', 'drop', 'reset client', 'reset server', ...]
    if action in deny_actions and match_action in deny_actions:
        return True
    else:
        return False

I would really like to avoid putting opinionated logic into generic match resolution while we provide easily extensible framework

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.